/*
 * @Author: your name
 * @Date: 2024-05-11 10:50:40
 * @LastEditTime: 2024-05-11 11:01:46
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \.leetcode\78.子集.cpp
 */
/*
 * @lc app=leetcode.cn id=78 lang=cpp
 *
 * [78] 子集
 */

// @lc code=start
class Solution {
public:
    vector<vector<int>> res;
    vector<int> path;
    void backtracking(vector<int>& nums, int startIndex){
        if(startIndex >= nums.size()){
            return;
        }
        
        for(int i = startIndex; i < nums.size(); i++){
            path.push_back(nums[i]);
            res.push_back(path);
            backtracking(nums, i+1);
            path.pop_back();
        }
    }
    vector<vector<int>> subsets(vector<int>& nums) {
        backtracking(nums, 0);
        res.push_back({});
        return res;
    }
};
// @lc code=end

